

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>添加商品种类</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>
 <form id="form-botton">
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-body" pad15>
           
            <div class="layui-form" lay-filter="">
              <div class="layui-form-item">
                <label class="layui-form-label">种类名称:</label>
                <div class="layui-input-inline">
                  <input type="text" name="name" lay-verify="required" lay-verType="tips" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">排序值:</label>
                <div class="layui-input-inline">
                  <input type="text" name="sort"  lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="save">保存</button>
                  <button type="reset" style="display: none;">重置</button>
                </div>
              </div>
            </div>
         
          </div>
        </div>
      </div>
    </div>
  </div>
   </form>
  <script src="/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set','form'], function(){
	  var form = layui.form
	  , $ = layui.$;
	  form.on('submit(save)', function(data){
		 $.ajax({
			 url:"/save",
			 type:"post",
			 data:data.field, // { name: xx, sort: xx }
			 dataType:"json",
			 success:function(res){
				 if(res.code==0){
					layer.msg('添加商品成功');
				  	$('#form-botton')[0].reset();
				 }
			 }
		 })
		 return false;
		

		});
	  
	  
  });
  </script>
</body>
</html>